//
//  UIViewController+LCLoadShop.m
//  JKFuYinProject
//
//  Created by admin on 2018/3/19.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "UIViewController+LCLoadShop.h"

@implementation UIViewController (LCLoadShop)

- (void)loginSuccessAndloadShopData {
    [LSZRequestResolutionDic initWithGetUserInformation:^(BOOL isOK, NSString * str, LSZPersonalInformationManager * manager) {
        if(isOK == YES ){
            NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults];
            [userDefaults setObject:@"yes" forKey:@"homePage"];
            NSString *uid = [NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults]objectForKey:@"uid"]];
            if([uid isEqualToString:@""]){
                [self performSelector:@selector(loginSuccessAndloadShopData) withObject:nil/*可传任意类型参数*/ afterDelay:1];
            }else{
                [self loadShopData];
            }
        }
    }];
    
}

- (void)loadShopData {
    NSString *uid = [NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults]objectForKey:@"uid"]];
    if([uid isEqualToString:@""]){
        return;
    }
#pragma mark -  加载主内商城网页  -
    NSString *url = [NSString stringWithFormat:@"%@?%@",shoopLogin,[UserPageManager getUrlStrMove]];
    NSLog(@"url = %@", url);
    Reachability *reach = [Reachability reachabilityWithHostName:url];
    if ([reach currentReachabilityStatus] == NotReachable){
        return;
    }
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:40.0f];//创建NSURLRequest
    [[PAWebView shareInstance].webView loadRequest:request];
}

@end
